package com.netty.pro.netty.inbound_outbound;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;

/**
 * @author xuzn
 * @ClassName: InoutserverHandler
 * @ProjectName netty-pro
 * @date 2020/3/20/8:08
 */
public class InoutserverHandler extends SimpleChannelInboundHandler<Long> {
  @Override
  protected void channelRead0(ChannelHandlerContext ctx, Long msg) throws Exception {
    System.out.println("从客户端:" + ctx.channel().remoteAddress() + "读取的long" + msg);
    ctx.writeAndFlush(1234598L);
  }

  @Override
  public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
    ctx.close();
  }
}
